//
//  LoginView.m
//  MZJ
//
//  Created by XDD on 16/6/2.
//  Copyright © 2016年 XDD. All rights reserved.
//

#import "LoginView.h"

@implementation LoginView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self initializeView];
    }
    return self;
}

- (void)initializeView {
    self.backgroundColor = [UIColor whiteColor];
    
//    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//    button1.frame = CGRectMake(100, 600, 100, 50);
//    button1.backgroundColor = [UIColor greenColor];
//    [button1 addTarget:self action:@selector(button1Action) forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:button1];
    
    UIImageView *logoImageView = [[UIImageView alloc]initWithFrame: CGRectMake(kWidth/2 - 55, 80, 110, 100)];
//    logoImageView.backgroundColor = [UIColor purpleColor];
    logoImageView.image = [UIImage imageNamed:@"logo_img@2x"];
    [self addSubview:logoImageView];
    
    _phoneNum_textField = [[UITextField alloc]initWithFrame:XJFlexibleFrame(CGRectMake(65, 195, 125, 25), NO)];
//    _phoneNum_textField.backgroundColor = [UIColor redColor];
    _phoneNum_textField.placeholder = @"请输入手机号";
    _phoneNum_textField.keyboardType = UIKeyboardTypeNumberPad;
    _phoneNum_textField.textAlignment = NSTextAlignmentCenter;
    _phoneNum_textField.font = [UIFont systemFontOfSize:14];
    [self addSubview:_phoneNum_textField];
    
    UIImageView *line_imageView1 = [[UIImageView alloc]initWithFrame:XJFlexibleFrame(CGRectMake(60, 212, 135, 4), NO)];
    line_imageView1.image = [UIImage imageNamed:@"kuang_img@2x"];
    [self addSubview:line_imageView1];
    
    _getCodeBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _getCodeBtn.frame = XJFlexibleFrame(CGRectMake(200, 198, 60, 20), NO);
    [_getCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
    _getCodeBtn.layer.cornerRadius = 2.0;
    _getCodeBtn.layer.masksToBounds = YES;
    [_getCodeBtn setTitleColor:[UIColor colorWithRed:148/255.0 green:148/255.0 blue:148/255.0 alpha:1] forState:UIControlStateNormal];
    _getCodeBtn.titleLabel.font = [UIFont systemFontOfSize:11];
    [_getCodeBtn addTarget:self action:@selector(getCodeAction) forControlEvents:UIControlEventTouchUpInside];
    _getCodeBtn.backgroundColor = [UIColor colorWithRed:217/255.0 green:217/255.0 blue:217/255.0 alpha:1];
    [self addSubview:_getCodeBtn];
    
    _codeNum_textField = [[UITextField alloc]initWithFrame:XJFlexibleFrame(CGRectMake(65, 245, 190, 25), NO)];
//    _codeNum_textField.backgroundColor = [UIColor redColor];
    _codeNum_textField.placeholder = @"请输入验证码";
    _codeNum_textField.keyboardType = UIKeyboardTypeNumberPad;
//    NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc]initWithString:@"请输入验证码"];
//    [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, attributedStr.length)];
    _codeNum_textField.textAlignment = NSTextAlignmentCenter;
//    _codeNum_textField.attributedPlaceholder = attributedStr;
    _codeNum_textField.font = [UIFont systemFontOfSize:14];
    [self addSubview:_codeNum_textField];
    
    UIImageView *line_imageView2 = [[UIImageView alloc]initWithFrame:XJFlexibleFrame(CGRectMake(60, 262, 200, 4), NO)];
    line_imageView2.image = [UIImage imageNamed:@"kuang_img@2x"];
    [self addSubview:line_imageView2];
    
    UIButton *login_btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    login_btn.frame = XJFlexibleFrame(CGRectMake(60, 300, 200, 25), NO);
    login_btn.backgroundColor = [UIColor colorWithRed:253/255.0 green:179/255.0 blue:10/255.0 alpha:1];
    [login_btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [login_btn setTitle:@"登陆" forState:UIControlStateNormal];
    login_btn.layer.cornerRadius = 3.0;
    login_btn.layer.masksToBounds = YES;
    [login_btn addTarget:self action:@selector(login_btnAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:login_btn];
    
//    UIView *lineView = [[UIView alloc]initWithFrame:XJFlexibleFrame(CGRectMake(60, 370, 200, 0.5f), NO)];
//    lineView.backgroundColor = [UIColor lightGrayColor];
//    [self addSubview:lineView];
    
//    UILabel *nextLogin_lab = [[UILabel alloc]initWithFrame:XJFlexibleFrame(CGRectMake(115, 360, 80, 20), NO)];
//    nextLogin_lab.backgroundColor = [UIColor whiteColor];
//    nextLogin_lab.text = @"第三方登陆";
//    nextLogin_lab.textAlignment = NSTextAlignmentCenter;
//    nextLogin_lab.textColor = [UIColor lightGrayColor];
//    nextLogin_lab.font = [UIFont systemFontOfSize:14];
//    [self addSubview:nextLogin_lab];
    
//    UIButton *login_QQ_btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    login_QQ_btn.frame = XJFlexibleFrame(CGRectMake(70, 410, 46, 46), YES);
//    login_QQ_btn.layer.cornerRadius = 23.0*XJVerticalMultiplier();
//    login_QQ_btn.layer.masksToBounds = YES;
//    [login_QQ_btn setImage:[UIImage imageNamed:@"QQ_login_img@2x"] forState:UIControlStateNormal];
//    [login_QQ_btn setTitle:@"QQ" forState:UIControlStateNormal];
//    [login_QQ_btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    login_QQ_btn.titleLabel.font = [UIFont systemFontOfSize:14];
//    [login_QQ_btn addTarget:self action:@selector(login_QQ_btnAction) forControlEvents:UIControlEventTouchUpInside];
//    login_QQ_btn.backgroundColor = [UIColor greenColor];
//    [self addSubview:login_QQ_btn];
    
//    UIButton *login_WX_btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    login_WX_btn.frame = XJFlexibleFrame(CGRectMake(204, 410, 46, 46), YES);
//    login_WX_btn.layer.cornerRadius = 23.0*XJVerticalMultiplier();
//    login_WX_btn.layer.masksToBounds = YES;
//    [login_WX_btn setImage:[UIImage imageNamed:@"WX_login_img@2x"] forState:UIControlStateNormal];
//    [login_WX_btn setTitle:@"微信" forState:UIControlStateNormal];
//    [login_WX_btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    login_WX_btn.titleLabel.font = [UIFont systemFontOfSize:14];
//    [login_WX_btn addTarget:self action:@selector(login_WX_btnAction) forControlEvents:UIControlEventTouchUpInside];
//    login_WX_btn.backgroundColor = [UIColor greenColor];
//    [self addSubview:login_WX_btn];
}

- (void)getCodeAction {
    if (self.didgetcodeButtonBlock) {
        self.didgetcodeButtonBlock();
    }
}

- (void)login_btnAction {
    if (self.didloginbtnButtonBlock) {
        self.didloginbtnButtonBlock();
    }
}

//- (void)login_QQ_btnAction {
//    if (self.didQQbtnButtonBlock) {
//        self.didQQbtnButtonBlock();
//    }
//}

//- (void)login_WX_btnAction {
//    if (self.didWXbtnButtonBlock) {
//        self.didWXbtnButtonBlock();
//    }
//}

- (void)animationShow {
    
}

@end
